package com.niiwoo.civet.trade.enums.kaola;

import com.niiwoo.tripod.provider.exception.NoSuchEnumValueException;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum KaoLaRepayOrderRepayTypeEnum {

    REPAY_NOMAL((byte) 1, "正常还款"),
    REPAY_SETTLE((byte) 2, "提前还款"),
    REPAY_OVERDUE((byte) 3, "逾期还款"),
    REPAY_BADLOANS((byte) 4, "严重逾期还款");
    
    private Byte value;

    private String desc;

    public static KaoLaRepayOrderRepayTypeEnum enumOf(Byte code) {
        return Arrays.stream(values())
                .filter(v -> v.getValue().equals(code))
                .findFirst()
                .orElseThrow(() -> new NoSuchEnumValueException(String.valueOf(code)));
    }

}
